// 播放时间戳处理
export function formatSongTime(duration = 0) {
  duration = duration / 1000
  const m = (Math.floor(duration / 60) + '').padStart(2, '0')
  const s = (Math.floor(duration % 60) + '').padStart(2, '0')
  return `${m}:${s}`
}

// 年月日时间戳格式化
export function formatDate(time) {
  const timer = new Date(time)
  const year = timer.getFullYear()
  const mouth = timer.getMonth() + 1 > 10 ? timer.getMonth() + 1 : '0' + (timer.getMonth() + 1)
  const date = timer.getDate() > 10 ? timer.getDate() : '0' + timer.getDate()
  return year + '年' + mouth + '月' + date + '日 '
}

// 过万数字处理
export function formatNum(val) {
  let num = 0
  if (val > 9999) {
    num = Math.round(val / 10000 * 10) / 10 + '万'
  } else {
    num = val
  }
  return num
}


